<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <!--<div class="container-fluid">-->
        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="pull-right">
                        <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i> 添加商品</h3>
                    </div>
                    <div class="panel-body">
                        <form action="{:U('save')}" method="post" enctype="multipart/form-data" onsubmit="return checkUserUpdate(this);">

                            <input type="hidden" name="id" value="{$info.id}"/>


                            <table class="table table-bordered">
                                <tbody>




                                <tr>
                                    <td class="col-sm-2">名称:</td>
                                    <td ><input type="text" class="form-control" name="title" value="{$info.title}"></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="col-sm-2">需要推荐数量:</td>
                                    <td ><input type="text" class="form-control" name="num" value="{$info.num}"></td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td>上传图片:  </td>
                                    <td>
                                        <input type="file" name="file" >
                                        <php>if(!empty($info['images'])){</php>
                                        <img src="{$info.images}" style="width:50px;"/>
                                        <php>}</php>
                                    </td>
                                </tr>

                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                        <!--<input type="reset" class="btn btn-default pull-right" value="重置">-->
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>

                    </div>
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>













    function checkUserUpdate(){





        var name = $('input[name="name"]').val();

        var tel = $('#tel').val();
        var cate_id = $('#cate_id').val();
        var error ='';
//        var goods_l = $('#goods_list').html();
//        if(goods_l ==null||goods_l ==''){
//            error += "请选择用户\n";
//        }
        if(name == ''){
            error += "真实姓名不能为空\n";
        }

        if(cate_id == 0){
            error += "请选择分类\n";
        }

        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>